package io.renren.modules.mybog.service.impl;

import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.mybog.dao.FocusDao;
import io.renren.modules.mybog.entity.FocusEntity;
import io.renren.modules.mybog.service.FocusService;
import org.springframework.util.StringUtils;


@Service("focusService")
public class FocusServiceImpl extends ServiceImpl<FocusDao, FocusEntity> implements FocusService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<FocusEntity> wrapper = new QueryWrapper<>();
        Object key = params.get("key");
        if(!StringUtils.isEmpty(key)){
            wrapper.eq("title",key);
        }
        IPage<FocusEntity> page = this.page(
                new Query<FocusEntity>().getPage(params),
                wrapper
        );

        return new PageUtils(page);
    }

}